﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Poney_fight_club
{
    class Arena
    {
        //6. "Champion de l'arène utilise Poney. Changer de poney ?"
        //Constructor here
        //Constructeur d'Arena
        public Arena(Pony _poney1, Pony _poney2)
        {
            current_Pony = 1;
            poneyl = _poney1;
            poneyr = _poney2;
        }

        //6. "Champion de l'arène utilise Poney. Changer de poney ?"
        //Attributes, getters for ponyl, ponyr and current_Pony here.
        //Attributs de la classe Arene
        int current_Pony;
        Pony poneyl, poneyr;
        //Accesseur des poneys
        public Pony Poneyl
        {
            get { return poneyl; }
            set { poneyl = value; }
        }

        public Pony Poneyr
        {
            get { return poneyr; }
            set { poneyr = value; }
        }

        public int Current_Pony
        {
            get { return current_Pony; }
            set { current_Pony = value; }
        }
        //6. "Champion de l'arène utilise Poney. Changer de poney ?"
        // Methods ChangeCurrentPoney(), AttackWith(), GetCurrentPoney(), GetDefensePoney() here
        //Methode qui change le poney attaquant en changeant la valeur de current_Pony
        public void ChangeCurrentPony()
        {
            if (current_Pony == 1)
                current_Pony = 2;
            else
                current_Pony = 1;
        }

        //Methode qui utilise la n-ième attaque du poney attaquant sur le defenseur
        public void AttackWith(int n)
        {
            GetDefensePoney.LoosePV(GetCurrentPoney.GetAttack(n));
        }

        //Recupere le poney attaquant
        public Pony GetCurrentPoney
        {
                get 
                { 
                    if (current_Pony == 1)
                        return poneyl;
                    else
                        return poneyr;
                }
        }

        //Recupere le poney defenseur
        public Pony GetDefensePoney
        {
            get
            {
                if (current_Pony == 1)
                    return poneyr;
                else
                    return poneyl;
            }
        }

        //Methode qui renvoie true si un poney est mort sinon false
        public bool IsFinish()
        {
            return !(poneyl.IsAlive() && poneyr.IsAlive());
        }
    }
}
